package com.megan.modules.system.controller;

import com.megan.common.core.response.ServerResponse;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import org.apache.commons.compress.utils.Lists;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

@RestController
@RequestMapping("/liteflow")
public class LiteFlowController {
    @Resource
    private FlowExecutor flowExecutor;

    @GetMapping("/execute")
    public ServerResponse<?> execute() {
        ArrayList<Object> objectArrayList = Lists.newArrayList();
        objectArrayList.add("1");
        objectArrayList.add("2");
        LiteflowResponse response = flowExecutor.execute2Resp("testFlow", objectArrayList);
        return ServerResponse.createBySuccess();
    }


}
